//
//  HJChatMessageModel.h
//  KaiChat
//
//  Created by lx on 2023/10/21.
//

#import <Foundation/Foundation.h>
#import "HJIMHeader.h"

NS_ASSUME_NONNULL_BEGIN

@class PHAsset;

@interface HJChatMessageModel : NSObject

//自己生成的查询数据的
@property (nonatomic, copy) NSString *msgId;

//服务器生成的做消息重发的
@property (nonatomic, copy) NSString *serverMsgId;

//自增长的Id, 给服务器用
@property (nonatomic, strong) NSNumber *sequenceMsgId;

@property (nonatomic, copy) NSString *bindingTipMsgId;

//消息发送者
@property (nonatomic, copy) NSString *senderId;
@property (nonatomic, copy) NSString *senderAvatar;       //发送者用户头像
@property (nonatomic, copy) NSString *senderNickname;     //发送者用户昵称

//消息接受者
@property (nonatomic, copy) NSString *receiverId;
@property (nonatomic, copy, nullable) NSString *receiverAvatar;       //接收者用户头像
@property (nonatomic, copy, nullable) NSString *receiverNickname;     //接收者用户昵称

//群相关
@property (nonatomic, copy, nullable) NSString *groupId;
@property (nonatomic, copy, nullable) NSString *groupName;

//会话相关
@property (nonatomic, copy) NSString *sessionId;
@property (nonatomic, copy) NSString *sessionName;
@property (nonatomic, copy) NSString *sessionUserd;//会话的userId
@property (nonatomic, copy) NSString *sessionUid;//会话的user, uid

@property (nonatomic, copy, nullable) NSString *sessionAvatar;

@property (nonatomic, assign) HJChatType chatType; //1000 单聊 2000群聊 3000广播

@property (nonatomic, assign) HJMessageType messageType;
@property (nonatomic, assign) HJMessageStatus msgStatus;
@property (nonatomic, assign) HJImageLoadStatus imageloadStatus;

@property (nonatomic, assign) HJChatSystemMsgType systemMsgType;
@property (nonatomic, assign) HJChatOfficialType officialType;
@property (nonatomic, assign) CGFloat progress;
@property (nonatomic, copy, nullable) NSString *localPath;
@property (nonatomic, copy, nullable) NSString *thumbnailPath;
@property (nonatomic, copy, nullable) NSString *thumbnailUrl;
@property (nonatomic, copy, nullable) NSString *fileUrl;
@property (nonatomic, copy, nullable) NSString *field;     //发送文件的时候用
@property (nonatomic, copy, nullable) NSString *thumbs;
@property (nonatomic, copy, nullable) NSString *content;
@property (nonatomic, copy, nullable) NSString *msg;
@property (nonatomic, copy, nullable) NSString *localIdentifier;
@property (nonatomic, copy, nullable) NSString *duration;
@property (nonatomic, copy, nullable) NSString *linkPreviewInfo;
@property (nonatomic, copy) NSString *extension;//HJTaskState
@property (nonatomic, copy) NSString *downloadPath;

@property (nonatomic, copy) NSString *disturb;

@property (nonatomic, strong) NSURL *fileURL;
@property (nonatomic, strong) PHAsset *asset;
@property (nonatomic, strong) UIImage *thumbnailImage;
@property (nonatomic, strong, nullable) UIImage *originalImage;
@property (nonatomic, copy, nullable) NSString *timestamp;   //毫秒级别
@property (nonatomic, copy) NSString *unReadCount;
@property (nonatomic, copy) NSString *at;
@property (nonatomic, copy) NSString *status;
@property (nonatomic, copy) NSString *voiceRead;
@property (nonatomic, copy) NSString *associationmMsgId;

@property (nonatomic, assign) NSInteger orderStatus;
@property (nonatomic, assign) NSInteger orderType;
@property (nonatomic, copy) NSString *orderId;
@property (nonatomic, copy) NSString *payCoin;
@property (nonatomic, copy) NSString *amount;

@property (nonatomic, assign) NSInteger totalUnitCount;
@property (nonatomic, assign) BOOL isForword;
@property (nonatomic, assign) BOOL isRetry;
@property (nonatomic, assign) BOOL isBlacklisted;
@property (nonatomic, assign) BOOL userInfoChange;
@property (nonatomic, assign) BOOL isReadDetail;

@property (nonatomic, assign, readonly) BOOL countedUnreadCount;

+ (NSString *)bg_tableNameWithSessionId:(NSString *)sessionId;

+ (nullable HJChatMessageModel *)messageModelWithDict:(NSDictionary *)dict;
+ (nullable HJChatMessageModel *)messageModelWithSessionDict:(NSDictionary *)sessionDict messageDict:(NSDictionary *)dict;
- (nullable NSAttributedString *)getTipMessageWithDict:(NSDictionary *)msgDict;
- (NSString *)getMessgetContent;
- (void)downloadVoice;
- (void)previewLink;


@end

NS_ASSUME_NONNULL_END
